<?php

include "dataConfig.php"; 

if($_SERVER["REQUEST_METHOD"] != "POST"){
    print_r(json_encode(array("msg" => "不支持get请求", "status" => 0)));
    return;
}

$CID = $_POST["cid"];

$sqlUpdate = "DELETE FROM cart WHERE cid=?";

$stmtU = $conn->prepare($sqlUpdate);
$stmtU->bind_param("i", $CID);
$stmtU->execute();

if($stmtU->affected_rows >= 1){
    print_r(json_encode(array("msg" => "删除成功", "status" => 1)));
} else {
    print_r(json_encode(array("msg" => "删除失败", "status" => -1)));
}
$stmtU->close();

$conn->close(); 